﻿using Report_IService.Web;
using Report_Service.Web;
using Report_Unity.Basic;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web;
using System.Web.Http;

namespace ReportWebApi.Controllers.Api.WeiXin
{
    [RoutePrefix("api/Report")]
    public class ReportController : ApiController
    {
        private static readonly string conn = ConfigurationManager.ConnectionStrings["Medical_SXEY"].ConnectionString;
        private IReportService ReportService = new ReportService(conn);

        [HttpPost,Route("GetListReport")]
        public ResultInfo GetListReport()
        {
            var req = HttpContext.Current.Request;
            string userid = req.Form["userid"];
            //string idcard = req.Form["idcard"];
            //string phone = req.Form["phone"];
            string hid = req.Form["hid"];
            ResultInfo res = ReportService.GetListReport(userid,hid);
            return res;
        }

        [HttpPost, Route("GetReportDetail")]
        public ResultInfo GetReportDetail()
        {
            var req = HttpContext.Current.Request;
            string ticket = req.Form["ticket"];
            ResultInfo res = ReportService.GetReportDetail(ticket);
            return res;
        }

        [HttpPost, Route("GetReportImage")]
        public ResultInfo GetReportImage()
        {
            var req = HttpContext.Current.Request;
            string ticket = req.Form["ticket"];
            ResultInfo res = ReportService.GetReportImage(ticket);
            return res;
        }

        [HttpPost,Route("GetReportCompany")]
        public ResultInfo GetReportCompany()
        {
            var req = HttpContext.Current.Request;
            string userid = req.Form["userid"];
            string hid = req.Form["hid"];

            ResultInfo res = ReportService.GetReportCompany(userid,hid);
            return res;
        }

        [HttpPost, Route("GetListEmployee")]
        public ResultInfo GetListEmployee()
        {
            var req = HttpContext.Current.Request;
            string userid = req.Form["userid"];
            string hid = req.Form["hid"];
            string cid = req.Form["cid"];

            ResultInfo res = ReportService.GetListEmployee(hid,cid,userid);
            return res;
        }

        [HttpPost, Route("GetListGroupReport")]
        public ResultInfo GetListGroupReport()
        {
            var req = HttpContext.Current.Request;
            string ticket = req.Form["ticket"];
            ResultInfo res = ReportService.GetListGroupReport(ticket);
            return res;
        }
    }
}
